<template>
  <div class="exhibition">
    <div class="main common">
      <div class="nav_x">
        <ul>
          <li @click="indexrout">首页 ></li>
          <li @click="slrout">实例 ></li>
          <li>实例展示</li>
        </ul>
      </div>
      <div class="exhib">
        <div class="leftmian">
          <ul>
            <li
              v-for="(item, index) in catenav"
              :key="index"
              :class="{ tj: shows == index }"
              @click="rout(index)"
            >
              {{ item.name }}
            </li>
          </ul>
        </div>
        <div class="rightmain">
          <p class="titleall">实例展示</p>
          <p class="entit">E-COMMERCE</p>
          <div class="exhib_flex">
            <dl
              v-for="(item, index) in datalist"
              :key="index"
              @click="xqrout(item.id)"
            >
              <dt><img :src="item.image" alt="" /></dt>
              <dd>
                <p>{{ item.title }}</p>
                <span>点击下载</span>
              </dd>
            </dl>
          </div>
          <p class="more">加载更多>>></p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import Swiper from "swiper";
import { caselist } from '@/api'

export default {
  name: 'exhibition_comp.vue',
  props: {
    msg: String
  },
  data() {
    return {
      datalist: [],
      catenav: [],
      shows: 0,
    };
  },
  methods: {
    rout(a) {
      const that = this;
      that.shows = a;
    },
    // 跳转详情
    xqrout(a) {
      console.log(a);
      this.$router.push({
        path: "/Sourexq",
        query: {
          id: a,
          name: 3,
        },
      });
    },
    // 接口
    async getCaselist() {
      await caselist().then((e) => {
        console.log(e, 11);
        this.datalist = e.data.data;
        this.catenav = e.data.cate;
      });
    },
    indexrout() {
      this.$router.push("/");
    },
    slrout() {
      this.$router.push("/Example");
    },
  },
  created() {
    // 接收id
    this.getCaselist();
  },
};
</script>

<style lang="scss" scoped>
.tj {
  background: #d7f0ff;
}

.exhibition {
  .main {
    // border: 1px solid red;
    margin: 0 auto;

    .nav_x {
      ul {
        overflow: hidden;
        padding: 15px 0;

        li {
          float: left;
          font-size: 18px;
          color: #999;
        }
      }
    }

    .exhib {
      box-shadow: 0px 0px 16px 4px rgba(0, 0, 0, 0.1);
      background: #f7f8fa;
      padding: 50px 0 39px 0;
      display: flex;
      justify-content: space-around;

      .leftmian {
        // border: 1px solid red;
        ul {
          border-radius: 10px;
          border: 1px solid #33cfff;

          li {
            width: 173px;
            height: 66px;
            cursor: pointer;
            border-radius: 10px 10px 0px 0px;
            text-align: center;
            line-height: 66px;
          }
        }
      }

      .rightmain {
        // border: 1px solid red;
        width: 80%;

        .exhib_flex {
          display: flex;
          width: 100%;
          justify-content: left;
          flex-wrap: wrap;

          dl {
            // border: 1px solid red;
            margin-top: 20px;
            border-radius: 10px;
            box-shadow: 0px 0px 16px 4px rgba(0, 0, 0, 0.2);
            border-radius: 5px;
            margin-left: 34.5px;
            width: 274px;
            height: 269px;

            dt {
              // width: 266px;
              // height: 180px;
              border-radius: 5px;

              img {
                border-radius: 10px;
                width: 100%;
              }
            }

            dd {
              display: flex;
              justify-content: space-around;
              padding: 10px 0;

              p {
                width: 138px;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                padding: 5px 5px;
              }

              span {
                display: block;
                padding: 5px 10px;
                background: #d7f0ff;
                // box-shadow: 0px 0px 16px 4px rgba(0, 0, 0, 0.3);
                border-radius: 15px;
                font-size: 14px;
                color: #4dcaf3;
              }
            }
          }
        }

        .more {
          font-size: 24px;
          color: #666666;
          text-align: center;
          margin-top: 50px;
        }
      }
    }
  }
}
</style>
